//Async/Await语法糖
async function main() {
  try {
    const user = await ajax("/api/users.json");
    console.log(user);
    const posts = await ajax("/api/posts.json");
    console.log(posts);
  } catch (e) {
    console.log(e);
  }
}

//返回一个promise
const promise = main();
promise.then(() => {
  console.log("all completed");
});
